package com.example.interview.controller;

import com.example.interview.config.R;
import com.example.interview.service.UserService;
import org.springframework.web.bind.annotation.*;


import javax.annotation.Resource;
import java.math.BigDecimal;


@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    UserService service;

    /**
     * 查询用户余额
     * @param userId 用户id
     * @return  返回余额信息
     */
    @PostMapping("/getBalance")
    public R queryBalance(long userId) {
        BigDecimal balance = service.queryBalance(userId);
        R<Object> result = R.success("success");
        result.setData(balance);
        return result;
    }

}
